<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<style>
			#d1{
				position:absolute;
				top: 0px;
				left: 0px;
			}
		</style>
		<script>
			var x,y;
			var obj;
			function  randomGif(){
				
				obj=document.getElementById("d1");
				x=Math.floor(Math.random()*600+10);
				y=Math.floor(Math.random()*480+10)
				
				obj.style.top=y+"px";
				obj.style.left=x+"px";
			}
			
			function  fire(){
				var obj=document.getElementById("a1");
				obj.play();
			}
			//这个也可以通过函数的方式来执行
			window.onload=randomGif;
		</script>
	</head>
	<body>
		<div id="d1">
			<audio src="../img/t1.wav" id="a1"></audio>
		    <button onclick="fire()">背景音乐</button>
			<img src="../img/timg.gif"/>
		</div>
	</body>
</html>
